package sword_offer;

import java.util.ArrayList;

/**
 * @author Synhard
 * @version 1.0
 * @Class sword_offer.TempQueue
 * @Description 队列
 * @tel 13001321080
 * @email 823436512@qq.com
 * @date 2021-03-19 16:38
 */
public class TempQueue<T> {
    public ArrayList<T> queue;

    public TempQueue(int capacity) {
        this.queue = new ArrayList<>(capacity);
    }

    public TempQueue() { this.queue = new ArrayList<>(); }

    public void push(T t) {
        queue.add(t);
    }

    public T getTop() {
        return queue.get(0);
    }

    public T pop() {
        T temp = this.getTop();
        queue.remove(0);
        return temp;
    }

    public int getLength() {
        return queue.size();
    }
}
